package com.github;


import com.github.sub.env.EnvCreateCommander;
import com.github.sub.env.EnvCurrentCommander;
import com.github.sub.env.EnvShowCommander;
import com.github.sub.inter.ExeCommander;
import com.github.sub.user.UserCreateCommander;
import com.github.sub.user.UserCurrentCommander;
import com.github.sub.user.UserShowCommander;
import com.github.sub.user.UserTokenCommander;

import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;


public class UserCommander extends Common implements Commander {

    private static final Map<String, Commander> MAP = new HashMap<>();

    static {
        MAP.put("-c", new UserCreateCommander());
        MAP.put("-cur", new UserCurrentCommander());
        MAP.put("-show", new UserShowCommander());
        MAP.put("-t", new UserTokenCommander());
    }

    @Override
    public Object run(Map<String, String> command) {
        command.forEach((k, v) -> {
            Commander commander = MAP.get(k);

            if (commander == null) {
                if (!k.equals("-e") && !k.equals("-u")) {
                    System.out.println(k + notFound);
                }

            } else {
                commander.run(command);
            }
        });
        return null;
    }
}
